<?php

/**
 * verwaltung actions.
 *
 * @package    adminslittlehelper
 * @subpackage verwaltung
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 2692 2006-11-15 21:03:55Z fabien $
 */
class showOverviewAction extends sfAction
{
  /**
   * Executes index action
   *
   */
  public function execute()
  {
  	$this->request_id = $this->getRequestParameter('id');
	$this->request_view = $this->getRequestParameter('view');
	$this->request_sid = $this->getRequestParameter('sid');

  	$c = new Criteria();
	$c->addAscendingOrderByColumn(KategoriePeer::NAME);
  	
  	$this->categories = KategoriePeer::doSelect($c);
  	
  	if(!empty($this->request_id) && $this->request_view == 'listSoftware'){
	    
  		$c = new Criteria();
		$c->addAscendingOrderByColumn(SoftwarePeer::NAME);
		$c->addAscendingOrderByColumn(SoftwarePeer::VERSION);
		$c->add(SoftwarePeer::KATEGORIE_ID, $this->getRequestParameter('id'));
	  	
	  	$this->software = SoftwarePeer::doSelect($c);
	  	
	  	if(empty($this->software)){
	  		$this->selected_category = new Kategorie();
	  		$this->request_view = '';
	  	}
	
  	}else{
	    $this->selected_category = new Kategorie();
  	}
  	
  	
  	
  	if(!empty($this->request_sid) && $this->request_view == 'editSoftware'){
  		$this->selected_software = SoftwarePeer::retrieveByPk($this->request_sid);
  	}else{
  		$this->selected_software = new Software();
  	}
  	
  	return sfView::SUCCESS;
  }
}